**This STATA code replicates the figure and tables in "Russia's Invasion of Ukraine and Votes in Favor of Russia in the UN General Assembly " by Farzanegan & Gholipour. 
***The code was run using STATA version 17. 
***Date: 6 Jan 2023
***Farzanegan@uni-marburg.de & H.Fereidouni@westernsydney.edu.au 

clear
*change directory to saved data on your system
cd "C:\Users\..."
use data_vote_rus_6jan2023.dta

*gen fdi_net_inflow_avg2015_21a=fdi_net_inflow_avg2015_21/1000
*gen loan_from_rus_ave_2015_2020a=loan_from_rus_ave_2015_2020/1000000000

*Table 1. Descriptive statistics


regress vote_favor_russua  defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21 russia_foreignaid_aid_morethan5p  sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia , vce(cluster country)

*Table 1. Descriptive statistics.

sum  vote_favor_russua  defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21 russia_foreignaid_aid_morethan5p  sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia if e(sample)


*Table 2. Drivers of vote in favor of Russia in the UN General Assembly resolution, Probit regression (average marginal effects).

** find a simialr sample in all estimations

probit vote_favor_russua exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21a russia_foreignaid_aid_morethan5p defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia, vce(cluster country)

generate general_model = e(sample)


** Model 1 (Economic factors)
estimates clear
probit vote_favor_russua exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21a russia_foreignaid_aid_morethan5p if general_model==1, vce(cluster country)
eststo economic: margins, dydx (*)  post


** Model 2 (Military & political factors)
probit vote_favor_russua defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue if general_model==1, vce(cluster country)
eststo political_military: margins, dydx (*)  post


** Model 3 (Geographical & historical factors)
probit vote_favor_russua sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia if general_model==1, vce(cluster country)
eststo geog_hist: margins, dydx (*)  post


** Model 4 (All factors)

probit vote_favor_russua exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21a russia_foreignaid_aid_morethan5p defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia, vce(cluster country)
eststo all: margins, dydx (*)  post


esttab using "results_probit_2October.rtf", cells(b(star fmt(3)) t(par fmt(3))) stats(r2 r2_a N, fmt(2) labels(Rsq. AdjRsq. Countries)) collabels(none) varlabels(_cons Constant defence_co_agreement " Defense Cooperation Agreement with Russia" exportpartnershare "Export Partner Share (%)" importpartnershare "Import Partner Share (%) " bi_inv_treaties "Bilateral Investment Treaties with Russia" fdi_net_inflow_avg2015_21 "Net FDI Inflow to Russia " sanction_eu "EU Sanctions" sanction_un "UN Sanctions" sanction_us "US Sanctions" soviet_member "Former member of Soviet Uninion" landborder_russia "Border with Russia" war_withsoviet "Had war with former Soviet" russia_foreignaid_aid_morethan5p "Getting more than 5 % of Russian aid" polity2_distance_russia "Polity2 gap from Russia " rus_top20_diplomatic_partners "Top 20 diplomatic partners of Russia "  shanghai_full_observer_dialogue "Shanghai Affiliates " ) title("Table 2: Drivers of vote in favour of Russia in UN, Probit, Marginal Effects") nomtitles star(* 0.10 ** 0.05 *** 0.01) replace note("*: 0.10 , **: 0.05 , ***: 0.01") varwidth(25) modelwidth(8)

* List of countries in general model

probit vote_favor_russua exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21a russia_foreignaid_aid_morethan5p defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia, vce(cluster country)

list country if e(sample)

******************


*Table 3. Factor analysis

*factortest

factortest   exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21a russia_foreignaid_aid_morethan5p defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia

factor exportpartnershare importpartnershare bi_inv_treaties fdi_net_inflow_avg2015_21a russia_foreignaid_aid_morethan5p defence_co_agreement polity2_distance_russia leader_left_share_1945_2020 rus_top20_diplomatic_partners shanghai_full_observer_dialogue sanction_eu sanction_un sanction_us soviet_member war_withsoviet landborder_russia, pcf

rotate

sortl

screeplot


gen trade_network=( soviet_member+ importpartnershare+ exportpartnershare+ landborder_russia)/4
gen sanction_exp=( sanction_eu + sanction_un + sanction_us )/3
gen political= ( polity2_distance_russia+ war_withsoviet+ shanghai_full_observer_dialogue+ rus_top20_diplomatic_partners)/4
gen defence_inv_network= (defence_co_agreement+ bi_inv_treaties)/2

estimates clear
probit vote_favor_russua    trade_network   sanction_exp political  defence_inv_network if general_model==1, vce(cluster country)
eststo factor_model: margins, dydx (*)  post

esttab using "results_probit_factor_model.rtf", cells(b(star fmt(3)) t(par fmt(3))) stats(r2 r2_a N, fmt(2) labels(Rsq. AdjRsq. Countries)) collabels(none)  title("Table 4: Drivers of vote in favour of Russia in UN, Probit, Average Marginal Effects, Factors") nomtitles star(* 0.10 ** 0.05 *** 0.01) replace note("*: 0.10 , **: 0.05 , ***: 0.01") varwidth(25) modelwidth(8)
